package redis.inaction.spring.ops;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import redis.inaction.spring.dao.CityDao;
import redis.inaction.spring.entity.City;

@Slf4j
@CacheConfig(cacheNames = "city")
public class SpringCacheOps {

    @Autowired
    private CityDao cityDao;

    @Cacheable
    public City getCity(String code){
        return cityDao.getCity(code);
    }
}
